/**
 */
package ram_pc.impl;

import org.eclipse.emf.common.notify.Notification;

import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.InternalEObject;

import org.eclipse.emf.ecore.impl.ENotificationImpl;

import ram_pc.Parameter;
import ram_pc.ParameterMapping;
import ram_pc.Ram_pcPackage;

/**
 * <!-- begin-user-doc -->
 * An implementation of the model object '<em><b>Parameter Mapping</b></em>'.
 * <!-- end-user-doc -->
 * <p>
 * The following features are implemented:
 * <ul>
 *   <li>{@link ram_pc.impl.ParameterMappingImpl#getFromElement <em>From Element</em>}</li>
 *   <li>{@link ram_pc.impl.ParameterMappingImpl#getToElement <em>To Element</em>}</li>
 * </ul>
 * </p>
 *
 * @generated
 */
public class ParameterMappingImpl extends MappingImpl implements ParameterMapping
{
  /**
   * The cached value of the '{@link #getFromElement() <em>From Element</em>}' reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getFromElement()
   * @generated
   * @ordered
   */
  protected Parameter fromElement;

  /**
   * The cached value of the '{@link #getToElement() <em>To Element</em>}' reference.
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @see #getToElement()
   * @generated
   * @ordered
   */
  protected Parameter toElement;

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  protected ParameterMappingImpl()
  {
    super();
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  protected EClass eStaticClass()
  {
    return Ram_pcPackage.Literals.PARAMETER_MAPPING;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public Parameter getFromElement()
  {
    if (fromElement != null && fromElement.eIsProxy())
    {
      InternalEObject oldFromElement = (InternalEObject)fromElement;
      fromElement = (Parameter)eResolveProxy(oldFromElement);
      if (fromElement != oldFromElement)
      {
        if (eNotificationRequired())
          eNotify(new ENotificationImpl(this, Notification.RESOLVE, Ram_pcPackage.PARAMETER_MAPPING__FROM_ELEMENT, oldFromElement, fromElement));
      }
    }
    return fromElement;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public Parameter basicGetFromElement()
  {
    return fromElement;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setFromElement(Parameter newFromElement)
  {
    Parameter oldFromElement = fromElement;
    fromElement = newFromElement;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, Ram_pcPackage.PARAMETER_MAPPING__FROM_ELEMENT, oldFromElement, fromElement));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public Parameter getToElement()
  {
    if (toElement != null && toElement.eIsProxy())
    {
      InternalEObject oldToElement = (InternalEObject)toElement;
      toElement = (Parameter)eResolveProxy(oldToElement);
      if (toElement != oldToElement)
      {
        if (eNotificationRequired())
          eNotify(new ENotificationImpl(this, Notification.RESOLVE, Ram_pcPackage.PARAMETER_MAPPING__TO_ELEMENT, oldToElement, toElement));
      }
    }
    return toElement;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public Parameter basicGetToElement()
  {
    return toElement;
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  public void setToElement(Parameter newToElement)
  {
    Parameter oldToElement = toElement;
    toElement = newToElement;
    if (eNotificationRequired())
      eNotify(new ENotificationImpl(this, Notification.SET, Ram_pcPackage.PARAMETER_MAPPING__TO_ELEMENT, oldToElement, toElement));
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public Object eGet(int featureID, boolean resolve, boolean coreType)
  {
    switch (featureID)
    {
      case Ram_pcPackage.PARAMETER_MAPPING__FROM_ELEMENT:
        if (resolve) return getFromElement();
        return basicGetFromElement();
      case Ram_pcPackage.PARAMETER_MAPPING__TO_ELEMENT:
        if (resolve) return getToElement();
        return basicGetToElement();
    }
    return super.eGet(featureID, resolve, coreType);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eSet(int featureID, Object newValue)
  {
    switch (featureID)
    {
      case Ram_pcPackage.PARAMETER_MAPPING__FROM_ELEMENT:
        setFromElement((Parameter)newValue);
        return;
      case Ram_pcPackage.PARAMETER_MAPPING__TO_ELEMENT:
        setToElement((Parameter)newValue);
        return;
    }
    super.eSet(featureID, newValue);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public void eUnset(int featureID)
  {
    switch (featureID)
    {
      case Ram_pcPackage.PARAMETER_MAPPING__FROM_ELEMENT:
        setFromElement((Parameter)null);
        return;
      case Ram_pcPackage.PARAMETER_MAPPING__TO_ELEMENT:
        setToElement((Parameter)null);
        return;
    }
    super.eUnset(featureID);
  }

  /**
   * <!-- begin-user-doc -->
   * <!-- end-user-doc -->
   * @generated
   */
  @Override
  public boolean eIsSet(int featureID)
  {
    switch (featureID)
    {
      case Ram_pcPackage.PARAMETER_MAPPING__FROM_ELEMENT:
        return fromElement != null;
      case Ram_pcPackage.PARAMETER_MAPPING__TO_ELEMENT:
        return toElement != null;
    }
    return super.eIsSet(featureID);
  }

} //ParameterMappingImpl
